<template name="asnReceiveRFListPage">
	<view>
		<scroll-view scroll-y class="page">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true" backRouterName="index">
			<block slot="content">收货列表</block>
		</cu-custom>
		<view class="cu-bar bg-gradual-blue search">
			<view class="search-form radius">
				<text class="cuIcon-search"></text>
				<input :adjust-position="false"  v-model="searchParam" @input="onInput"  type="text" placeholder="ASN或者外部单号" confirm-type="search" @confirm="search()"></input>
			</view>
		</view>
		<view>
			<view class="cu-list menu-avatar padding-sm">
				<view class="cu-item margin-bottom-sm animation-slide-bottom bg-gradual-blue padding radius text-center shadow-blur" v-for="(item,index) in receiveList" @tap="chooseAsn(item)">
					<view class="cu-avatar square lg" style="background-image:url(/static/home/128/shouhuo.png);">
					</view>
					<view class="content">
						<view class="text-yellow text-bold">[{{item.asnCode}}]</view>
						<view class="text-gray text-sm flex">
							<view class="text-cut text-bold">
								<text class="text-white margin-right-xs">[外部单号]：{{item.customerBill}}</text>
							</view> 
						</view>
						<view class="text-gray text-sm flex text-bold">
							<view class="text-cut">
								<text class="text-white margin-right-xs">[已收数量]：{{item.recived}}</text>
							</view> 
						</view>
					</view>
					<view class="action">
						<view class="cu-tag square bg-gradual-orange sm">{{item.totalQty}}</view>
					</view>
				</view>
			</view>
		</view>
		</scroll-view>
	</view>
</template>



<script>
	import crypto from '@/api/crypto.js' 
	export default {
		data() {
			return {
				searchParam:'',
				receiveList:[],
				receiveUrl:'/pda/initReceiveList'
			}
		},
		onLoad:function(){
			this.initReceiveList();
		},
		methods: {
			initReceiveList(){
				this.$http.get(this.receiveUrl,{params:{searchParam:crypto.encrypt(this.searchParam)}}).then(res=>{
				  if(res.data.success){
					  this.receiveList = res.data.result;
				  }else{
					 this.$tip.error(res.data.message);
				  }
				}).catch(()=>{
					this.$tip.loaded();
				});
			},
			onInput(e){
				this.searchParam = e.target.value
			},
			chooseAsn(item){
				uni.navigateTo({
					url: '/pages/wms/asnReceiveRFPalletInputPage?item='+ encodeURIComponent(JSON.stringify(item))
				});
			},
			search(){
				this.initReceiveList();
			}
		}
	}
</script>

<style>
</style>